#ifndef __COMMON_ARDUINO_H
#define __COMMON_ARDUINO_H

#include <stdio.h>
#include <math.h>
#include "util.h"

#define LOW  0
#define HIGH 1

#define INPUT  0
#define OUTPUT 1

#define DEC 0
#define HEX 1


void pinMode( int pin, int mode);

int analogRead( int pin);
void analogWrite( int pin, int value);
int digitalRead( int pin);
void digitalWrite( int pin, int value);

void delay( long milliseconds);
long millis();


class Serial_Dummy
{
  public:
	void begin( int bauds) {
		printf( "Serial_Dummy.begin(%d)\n", bauds);
	}
	void print( const char *str) {
		printf( "*SERIAL: %s", str);
	}
	void print( int value) {
		printf( "*SERIAL: %d", value);
	}
	void print( int value, int mode) {
		if( mode == DEC) {
			printf( "*SERIAL: %d", value);
		}
		else {
			printf( "*SERIAL: %x", value);
		}
	}

	void println() {
		printf( "\n");
	}
	void println( const char *str) {
		printf( "*SERIAL: %s\n", str);
	}
	void println( int value) {
		printf( "%d\n", value);
	}
	void println( int value, int mode) {
		print( value, mode);
		println();
	}

	bool available() {
		if( kbhit()) {
			printf( "Available!\n");
			return true;
		}
		printf( "NOT available!\n");
		return false;
	}
	int read( ) {
		return getch();
	}
};

extern Serial_Dummy Serial, Serial2, Serial3;



#endif


